{% extends "../theme/bage_add_edit.html" %}
{% block typebody %}

<ol class="breadcrumb">
    <li><a href="/">{{ _('Home') }}</a></li>
    <li><a href="/tutorial/">{{ _('Tutorials') }}</a></li>
    <li class="active">{{ _('Modify') }} - {{ postinfo.title }}</li>
</ol>
<div class="panel panel-black">
    <div class="panel-heading">
        {{ _('Modify') }} - {{ postinfo.title }}
    </div>
    <div class="panel-body">
        <form method="post" class="form-horizontal" role="form" id="form_post">
            <fieldset>
                <input type="hidden" id="id_post" name="id_post" value="{{ postinfo.uid }}"/>
                <input type=hidden id="keywords" name="keywords">

                <div class="form-group">
                    <label for="title" class="col-sm-2 control-label">{{ _('title') }}</label>

                    <div class="col-sm-10">
                        <input type="text" id="title" name="title" value="{{ postinfo.title }}"
                               class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="tags">{{ _('label') }}</label>

                    <div class="col-sm-10">
                        <input class="form-control" id="tags" name="tags" type="text"
                               value="{% for x in app2label_info %}
                {{ x.tag_name }},
                {% end  %}">
                    </div>
                </div>
                {% for ii in range(0,5) %}
                <div class="form-group">
                    {% if ii == 0 %}
                    <label class="col-sm-2 control-label" for="pcat0">{{ _('Category') }}</label>
                    {% else %}
                    <label class="col-sm-2 control-label"></label>
                    {% end %}
                    <div class="col-sm-3">
                        <select name="pcat{{ii}}" id="pcat{{ii}}" class="form-control"
                                onchange="g_load_postcat({{ii}})">
                            <option value="">{{ _('Please select') }}</option>
                            {% for taginfo in tag_infos %}
                            {% if taginfo.uid.endswith('00') %}
                            <option value="{{ taginfo.uid }}"
                                    {% for tt in app2tag_info %}
                                    {% if tt.order== ii and tt.tag_id.startswith(taginfo.uid[:2]) %}
                                    selected
                                    {% end %}
                                    {% end %}>{{ taginfo.name }}
                            </option>
                            {% else %}

                            {% end %}
                            {% end %}
                        </select>
                    </div>
                    <div class="col-sm-4">
                        <select name="gcat{{ii}}" id="gcat{{ii}}" class="form-control">
                            <option value="0">{{ _('Please select') }}</option>

                            {% set pcatid = 'xx' %}
                            {% for taginfo in tag_infos %}
                            {% for tt in app2tag_info %}
                            {% if tt.order== ii and tt.tag_id== taginfo.uid %}
                            {% set pcatid = tt.tag_id[:2] %}
                            {% end %}
                            {% end %}
                            {% end %}

                            {% for taginfo in tag_infos %}
                            {% if taginfo.uid.startswith(pcatid) %}
                            {% if not taginfo.uid.endswith('00') %}
                            <option value="{{ taginfo.uid }}"
                                    {% for tt in app2tag_info %}
                                    {% if tt.order== ii and tt.tag_id== taginfo.uid %}
                                    selected
                                    {% end %}
                                    {% end %}>{{ taginfo.name }}
                            </option>
                            {% else %}
                            {% end %}
                            {% end %}
                            {% end %}

                        </select>
                    </div>

                </div>
                {% end %}


                <div class="form-group">
                    <label for="logo" class="col-sm-2 control-label">{{ _('picture') }}</label>

                    <div class="col-sm-10">
                        <input id="logo" name="logo" type="text" value="{{ postinfo.logo }}" class="form-control"
                               readonly/>
                        <br>
                        <a class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal">上传图片</a>
                    </div>
                </div>


                <div class="form-group">
                    <label for="cnt_md" class="col-sm-2 control-label">{{ _('Content') }}</label>

                    <div class="col-sm-10">
            <textarea rows=26 id="cnt_md" name="cnt_md" cols="80" class="form-control">
                {% raw unescape(postinfo.cnt_md) %}
            </textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label for="sub1" class="col-sm-2 control-label"></label>

                    <div class="col-sm-10">
                        <input id="sub1" type="submit" class="btn btn-primary" value="{{ _('submit') }}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="memo">{{ _('Memo') }}</label>

                    <div class="col-sm-10">
                        <textarea class="form-control" rows=10 id="memo" name="memo">
                        {% raw unescape(postinfo.memo) %}
                        </textarea>
                    </div>
                </div>
            </fieldset>
        </form>
        {% module upload_pic() %}
    </div>
</div>
{% end %}


